<html>
<head><meta charset="utf-8"><title>issue #70818 · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html">issue #70818</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="196053922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196053922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196053922">(May 02 2020 at 14:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116883">@tmandry</span> the doc of <code>GeneratorInteriorTypeCause</code> declared it will record yield-cross data <strong>and</strong> <a href="https://github.com/rust-lang/rust/blob/7184d137f65bb8d143ce8b5b664e50d33c4b5fbd/src/librustc_middle/ty/context.rs#L284" title="https://github.com/rust-lang/rust/blob/7184d137f65bb8d143ce8b5b664e50d33c4b5fbd/src/librustc_middle/ty/context.rs#L284">captured types</a>(upvars I guess), but <a href="https://github.com/rust-lang/rust/blob/42abbd8878d3b67238f3611b0587c704ba94f39c/src/librustc_typeck/check/generator_interior.rs#L67" title="https://github.com/rust-lang/rust/blob/42abbd8878d3b67238f3611b0587c704ba94f39c/src/librustc_typeck/check/generator_interior.rs#L67">only yield_data</a> were recorded during interior visiting. <br>
So, for later error reporting, I'm going to record upvars in this <a href="https://github.com/rust-lang/rust/blob/42abbd8878d3b67238f3611b0587c704ba94f39c/src/librustc_typeck/check/generator_interior.rs#L119" title="https://github.com/rust-lang/rust/blob/42abbd8878d3b67238f3611b0587c704ba94f39c/src/librustc_typeck/check/generator_interior.rs#L119">to-be-created-else branch</a>, is this approach appliable?</p>



<a name="196179594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196179594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196179594">(May 04 2020 at 13:28)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="p">(</span><span class="n">ty</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">impl</span><span class="w"> </span><span class="n">Future</span><span class="o">&lt;</span><span class="n">Output</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="nb">Send</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">async</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">ty</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>not only the <code>ty</code>, but <code>future::ResumeTy</code> is recorded as <code>GeneratorInteriorTypeCause</code> accidently.<br>
will invest more.</p>



<a name="196379600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196379600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196379600">(May 05 2020 at 23:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116773">@csmoe</span> sorry, just getting to this after a long weekend</p>



<a name="196379661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196379661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196379661">(May 05 2020 at 23:10)</a>:</h4>
<p>the <code>ResumeTy</code> of the generator shouldn't get recorded, I thought we resolved that issue already (cc <span class="user-mention" data-user-id="211727">@Jonas Schievink</span>)</p>



<a name="196379721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196379721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196379721">(May 05 2020 at 23:11)</a>:</h4>
<p>I fixed it getting allocated space in the generator, but not the typeck part</p>



<a name="196379804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196379804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196379804">(May 05 2020 at 23:12)</a>:</h4>
<p>ah, I see. okay.</p>



<a name="196379853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196379853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196379853">(May 05 2020 at 23:13)</a>:</h4>
<p>regarding upvars, I don't think we handle them in <code>GeneratorInteriorTypeCause</code> because they aren't captured "in the interior" of the generator, perhaps</p>



<a name="196379872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196379872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196379872">(May 05 2020 at 23:13)</a>:</h4>
<p>that is, "captured types" in this context probably doesn't mean upvars</p>



<a name="196379907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196379907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196379907">(May 05 2020 at 23:14)</a>:</h4>
<p>..because generators are also closures, and closure upvars are handled in a separate path, somewhere</p>



<a name="196380029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196380029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196380029">(May 05 2020 at 23:15)</a>:</h4>
<p>I'm not sure how much work it would be to add obligations from upvars to the same list, for the purpose of error reporting</p>



<a name="196380060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196380060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196380060">(May 05 2020 at 23:15)</a>:</h4>
<p>maybe <span class="user-mention" data-user-id="116009">@nikomatsakis</span> knows</p>



<a name="196380451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196380451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196380451">(May 05 2020 at 23:21)</a>:</h4>
<p>..oh, there's a PR up :)</p>



<a name="196380459"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196380459" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196380459">(May 05 2020 at 23:21)</a>:</h4>
<p>(<a href="https://github.com/rust-lang/rust/issues/71923" title="https://github.com/rust-lang/rust/issues/71923">#71923</a>)</p>



<a name="196380551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196380551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196380551">(May 05 2020 at 23:22)</a>:</h4>
<p>(lol, I just realized I explicitly said to do this in some mentoring instructions a few weeks ago)</p>



<a name="196382409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196382409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196382409">(May 05 2020 at 23:49)</a>:</h4>
<p>it looks like you figured it out. I left a review, thanks <span class="user-mention" data-user-id="116773">@csmoe</span>!</p>



<a name="196610068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/issue%20%2370818/near/196610068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/issue.20.2370818.html#196610068">(May 06 2020 at 09:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116883">tmandry</span> <a href="#narrow/stream/187312-wg-async-foundations/topic/issue.20.2370818/near/196379872" title="#narrow/stream/187312-wg-async-foundations/topic/issue.20.2370818/near/196379872">said</a>:</p>
<blockquote>
<p>that is, "captured types" in this context probably doesn't mean upvars</p>
</blockquote>
<p><span class="user-mention" data-user-id="116883">@tmandry</span> so I just query and filter the upvars during error reporting instead of record them into generator interior, new commits waiting for your review.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>